<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>添加留言</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="css/screen.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
function mycheck(){
		if(myform.pass.value == ""){
			alert("密码不能为空！");
			myform.pass.focus();
			return false;
		}else{
			if(myform.pass.value != myform.repass.value){
				alert("输入两次密码不同！");
				myform.pass.focus();
				return false;
			}
		}
		if(myform.email.value != ""){
			 reg=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi;
    		if(!reg.test(myform.email.value))
    		{
        		alert("非法的电子邮件");
        		myform.email.focus();
        		return false;
    		}
		}
		if(myform.phone.value != ""){
			var tel = /(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)|(13\d{9}$)|(15[0135-9]\d{8}$)|(18[267]\d{8}$)/;
			var number = myform.phone.value; 
			if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(number))){
				if(number != "" && number.replace(/\s/g,"")!="" && !(tel.exec(number))){
    				alert("联系方式有误");
    				myform.phone.focus();
    				return false;
				}
        	}
        }
	}
</script>

</head>

<body>
	<s:form action="modifyuser" method="post" enctype="multipart/form-data"
		name="myform">
		<table width="600px" align="center" class="class1">
			<tr>
				<td colspan="3" align="right"><span class="title">修改用户信息</span>
				</td>
			</tr>
			<tr>
				<td width="10%">&nbsp;</td>
				<td>
					<table>
						<tr>
							<td width="10%" align="left">真实名字</td>
							<td width="25%"><s:textfield name="user.name" id="name" />
								<s:hidden name="user.userid" />
							</td>
						<tr>
						<tr>
							<td>密码</td>
							<td><s:textfield type="password" name="user.pass" id="pass" />
							</td>
						<tr>
						<tr>
							<td>再次输入</td>
							<td><s:textfield type="password" name="user.repass"
									id="repass" />
							</td>
						<tr>
						<tr>
							<td>联系方式</td>
							<td><s:textfield name="user.phone" id="phone" />
							</td>
						<tr>
						<tr>
							<td>email</td>
							<td><s:textfield name="user.email" id="email" />
							</td>
						<tr>
						<tr>
						<td>邮箱提醒开关</td>
						<td><select name="user.alertstate" id="alertstate">
						<option value=0>关闭</option>
						<option value=1>打开</option>
						</select>
						</tr>
						<tr>
						<td>邮箱提醒时间</td>
						<td><select name="user.alerttime" id="alerttime">
						<option value=0>00:00--01:00</option>
						<option value=1>01:00--02:00</option>
						<option value=2>02:00--03:00</option>
						<option value=3>03:00--04:00</option>
						<option value=4>04:00--05:00</option>
						<option value=5>05:00--06:00</option>
						<option value=6>06:00--07:00</option>
						<option value=7>07:00--08:00</option>
						<option value=8>08:00--09:00</option>
						<option value=9 >09:00--10:00</option>
						<option value=10>10:00--11:00</option>
						<option value=11>11:00--12:00</option>
						<option value=12>12:00--13:00</option>
						<option value=13>13:00--14:00</option>
						<option value=14>14:00--15:00</option>
						<option value=15>15:00--16:00</option>
						<option value=16>16:00--17:00</option>
						<option value=17>17:00--18:00</option>
						<option value=18>18:00--19:00</option>
						<option value=19>19:00--20:00</option>
						<option value=20>20:00--21:00</option>
						<option value=21>21:00--22:00</option>
						<option value=22>22:00--23:00</option>
						<option value=23>23:00--00:00</option>
						</select>
							</td>
					
						<tr>
							<td colspan="2" align="center"><input type="submit"
								value="确 认" onClick="return mycheck();" />
							</td>
						</tr>
						<tr>
							<td colspan="2" align="center"><span class="errorAndmes"><s:actionerror
										cssStyle="font-family: Arial,Helvetica,sans-serif" /> </span>
							</td>
						</tr>
					</table></td>
				<td width="20%">&nbsp;</td>
		</table>
	</s:form>
</body>
</html>
